<template>
	<view>
		<button type="primary" @click="chooseImg">上传图片</button>
		<image v-for="item in imgArr" :src="item"></image>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: ['前端', 'JAVA', 'UI', '测试', '大数据'],
				imgArr: []
			}
		},

		methods: {
			pullDown() {
				console.log('开启下拉刷新')
				uni.startPullDownRefresh()
			},
			previewImg(current) {
				uni.previewImage({
					current,
					urls: this.imgArr,
					loop: true,
					indicator: 'default'
				})
			},
			chooseImg() {
				uni.chooseImage({
					count: 5,
					success: res => {
						this.imgArr = res.tempFilePaths
					}
				})
			}
		},
		onPullDownRefresh() {
			console.log('触发了下拉刷新')
			setTimeout(() => {
				this.list = ['JAVA', 'UI', '前端', '测试', '大数据', '后端']
				uni.stopPullDownRefresh()
			}, 2000)
		},
		onReachBottom() {
			console.log('页面触底了')
			this.list = [...this.list, ...['JAVA', 'UI', '前端', '测试', '大数据', '后端']]
		}
	}
</script>

<style>
	.box-item {
		height: 100px;
		line: style 100px;
		line-height: 100px;
	}

	/* h5中的样式 */
	/* #ifdef H5 */
	view {
		color: hotpink;
	}

	/* #endif */
	/* 微信小程序中的样式 */
	/* #ifdef MP-WEIXIN */
	view {
		color: #0000FF;
	}

	/* #endif */
</style>